---
--- i26_widgetcreation.lua
--- Description: 容器
--- Author: 旅行者
--- Date: 2025/3/1 11:36
---

GLOBAL.setmetatable(env, {
    __index = function(t, k)
        return GLOBAL.rawget(GLOBAL, k)
    end
})

local containers = require "containers"
local params = containers.params

local I26_FLOWER_SACK = TUNING.ENTITY_LIST.I26_FLOWER_SACK
local i26_flower_sack_size = TUNING.I26_FLOWER_SACK_SIZE or 11

local i26_flower_sack_anim = "i26_new_ui_bigbag_3x12"
if i26_flower_sack_size == 4 then
    i26_flower_sack_anim = "i26_new_ui_bigbag_3x5"
elseif i26_flower_sack_size == 7 then
    i26_flower_sack_anim = "i26_new_ui_bigbag_3x8"
end

params[I26_FLOWER_SACK.id] = {
    widget = {
        slotpos = {},
        animbank = i26_flower_sack_anim,
        animbuild = i26_flower_sack_anim,
        slotbg = {},
        pos = Vector3(-160, -70, 0),
        buttoninfo = nil
    },
    issidewidget = true,
    type = I26_FLOWER_SACK.id,
    openlimit = 1,
}
-- -110 -428
-- -30 -348
local SLOT_BG = { image = "spore_slot.tex", atlas = "images/inventoryimages/spore_slot.xml" }
for y = 0, i26_flower_sack_size do
    for x = 0, 2 do
        table.insert(params[I26_FLOWER_SACK.id].widget.slotpos, Vector3(75 * (x - 2) + 45, 75 * (y - 2) - 273, 0))
        table.insert(params[I26_FLOWER_SACK.id].widget.slotbg, SLOT_BG)
    end
end

for k, v in pairs(params) do
    containers.MAXITEMSLOTS = math.max(containers.MAXITEMSLOTS, v.widget.slotpos ~= nil and #v.widget.slotpos or 0)
end